package org.platform.core.event;


import com.mc.mic.core.tool.helper.SpringContextHelper;

/**
 * @author mabb
 */
public class PublishFactory {

    // 单例变量
    private static PublishFactory _instance;

    private BusEventPublisher _publisher;

    /**
     * 私有化构造函数
     */
    private PublishFactory() {
        _publisher = SpringContextHelper.getBean(BusEventPublisher.class);
    }

    /**
     * 单例方法
     *
     * @return
     */
    public synchronized static PublishFactory getInstance() {
        if (null == _instance) {
            _instance = new PublishFactory();
        }
        return _instance;
    }

    /**
     * 发布事件
     *
     * @param event
     */
    public void publishEvent(BusEvent event) {
        _publisher.publish(event);
    }
}
